// 统一管理首页模块接口
import request from "@/utils/request";


enum API {
    SUBMITORDER_URL='/order/orderInfo/auth/submitOrder/',
    GETORDERINFO_URL='/order/orderInfo/auth/getOrderInfo/',
    ORDERCANCEL_URL='/order/orderInfo/auth/cancelOrder/',
    QRCODE_URL='/order/weixin/createNative/',
    PAYRESULT_URL='/order/weixin/queryPayStatus/',
    USERINFO_URL='/user/auth/getUserInfo',
    CERTIFICATIONTYPE_URL='/cmn/dict/findByDictCode/',
    USERCERTATION_URL='/user/auth/userAuah',
    USERORDERINFO_URL='/order/orderInfo/auth/',
    ALLUSER_URL='/user/patient/auth/findAll',
    ORDERSTATE_URL='/order/orderInfo/auth/getStatusList',
    CITY_URL='/cmn/dict/findByParentId/',
    ADDUSER_URL='/user/patient/auth/save',
    UPDATEUSER_URL='/user/patient/auth/update',
    DELETEUSER_URL='/user/patient/auth/remove/'
}

// 提交订单
export const reqSubmitOrder=(hoscode:any,scheduleId:any,patientId:any)=>request.post<any,any>(API.SUBMITORDER_URL + `${hoscode}/${scheduleId}/${patientId}`)

// 获取订单详情的方法
export const reqOrderInfo =(id:any)=>request.get<any,any>(API.GETORDERINFO_URL+id)

// 取消订单的接口
export const reqCancelOrder =(orderId:any)=>request.get<any,any>(API.ORDERCANCEL_URL+orderId)

// 获取支付二维码
export const reqQrcode =(orderId:any)=>request.get<any,any>(API.QRCODE_URL+orderId)

// 查询订单支付结果
export const reqQueryPayState =(orderId:any)=>request.get<any,any>(API.PAYRESULT_URL+orderId)

// 获取当前用户信息的接口
export const reqUserInfo = ()=>request.get<any,any>(API.USERINFO_URL)

// 获取证件类型的方法
export const reqCertationType = (CertificatesType='CertificatesType')=>request.get<any,any>(API.CERTIFICATIONTYPE_URL+CertificatesType)

// 用户认证的接口
export const reqUserCertation =(data:any)=>request.post<any,any>(API.USERCERTATION_URL,data)

// 获取用户订单的数据
export const reqUserOrderInfo =(page:any,limit:any,patientId:any,orderStatus:any)=>request.get<any,any>(API.USERORDERINFO_URL+`${page}/${limit}?patientId=${patientId}&orderStatus=${orderStatus}`)

// 获取全部就诊人的信息
export const reqAllUser=()=>request.get<any,any>(API.ALLUSER_URL)

// 获取订单状态
export const reqOrderState=()=>request.get<any,any>(API.ORDERSTATE_URL)

// 获取城市的数据
export const reqCity =(parentId:any)=>request.get<any,any>(API.CITY_URL + parentId)

// 新增与修改已有的就诊人方法
export const reqAddOrUpdateUser=(data:any)=>{
    if(data.id){
        return request.put<any,any>(API.UPDATEUSER_URL,data)
    }else {
        return request.post<any,any>(API.ADDUSER_URL,data)
    }
}

// 删除某一个就诊人的信息
export const reqRemoveUser=(id:any)=>request.delete<any,any>(API.DELETEUSER_URL + id)













